package org.bright.service.impl;

import org.bright.entity.PurchaseOrderDetails;
import org.bright.mapper.PurchaseOrderDetailsMapper;
import org.bright.service.IPurchaseOrderDetailsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.bright.vo.PurchaseOrderDetailsProductsVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * <p>
 * 采购明细表 记录每个采购订单的具体商品信息。 服务实现类
 * </p>
 *
 * @author bright
 * @since 2024-10-21
 */
@Service
public class PurchaseOrderDetailsServiceImpl extends ServiceImpl<PurchaseOrderDetailsMapper, PurchaseOrderDetails> implements IPurchaseOrderDetailsService {
    @Autowired
    private PurchaseOrderDetailsMapper purchaseOrderDetailsMapper;

    @Override
    public int insertIntoOrderDetails(List<PurchaseOrderDetails> purchaseOrderDetails) {
        return purchaseOrderDetailsMapper.insertBatch(purchaseOrderDetails);
    }

    @Override
    public List<PurchaseOrderDetailsProductsVO> selectAllByOrderIdAndSupplierId(String orderId, Integer supplierId) {
        return purchaseOrderDetailsMapper.selectAllByOrderIdAndSupplierId(orderId, supplierId);
    }

    @Override
    public List<PurchaseOrderDetails> selectProductIdFromOrderId(String orderId) {
        return purchaseOrderDetailsMapper.selectAllByOrderId(orderId);
    }
}
